<?php
class Req_sfsHLSG {
	const url = "http://127.0.0.1:38899/huanLeShuiGuo/lobbyHandler";
	static function http_post_data($url, $data_string) {
		$ch = curl_init ( $url );
		curl_setopt ( $ch, CURLOPT_CUSTOMREQUEST, "POST" );
		curl_setopt ( $ch, CURLOPT_POSTFIELDS, $data_string );
		curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, true );
		curl_setopt ( $ch, CURLOPT_TIMEOUT, 5 );
		curl_setopt ( $ch, CURLOPT_HTTPHEADER, array (
				'Content-Type: application/json',
				'Content-Length: ' . strlen ( $data_string ) 
		) );
		$data = curl_exec ( $ch );
		return $data;
	}
	/**
	 *
	 * @return unknown
	 */
	function GetConfig() {
		$arr = array (
				'req' => '1' 
		);
		$json_string = json_encode ( $arr );
		return Req_sfsHLSG::http_post_data ( Req_sfsHLSG::url, $json_string );
	}
	/**
	 *
	 * @param unknown $conn        	
	 * @param unknown $name        	
	 * @param unknown $coin        	
	 * @param unknown $limit        	
	 * @param unknown $bet        	
	 * @return unknown
	 */
	function SetConfig($conn, $name, $coin, $limit, $bet, $roundLock, $maxEnter, $minEnter, $baoJi, $xianZhu, $robotCount, $maxBet) {
		$arr = array (
				'req' => '2',
				'1' => $conn,
				'2' => $name,
				'3' => $coin,
				'4' => $limit,
				'5' => $bet,
				'6' => $roundLock,
				'7' => $maxEnter,
				'8' => $minEnter,
				'9' => $baoJi,
				'10' => $xianZhu ,
				'11' => $robotCount,
				'12' => $maxBet 
		);
		$json_string = json_encode ( $arr );
		return Req_sfsHLSG::http_post_data ( Req_sfsHLSG::url, $json_string );
	}
	/**
	 *
	 * @return unknown
	 */
	function GetTotalAccount() {
		$arr = array (
				'req' => '3' 
		);
		$json_string = json_encode ( $arr );
		return Req_sfsHLSG::http_post_data ( Req_sfsHLSG::url, $json_string );
	}
	/**
	 *
	 * @return mixed
	 */
	function GetDetailAccount() {
		$arr = array (
				'req' => '4',
				'1' => '329-32900102' 
		);
		$json_string = json_encode ( $arr );
		return Req_sfsHLSG::http_post_data ( Req_sfsHLSG::url, $json_string );
	}
	/**
	 *
	 * @return mixed
	 */
	function GetBetDetail($type, $key, $start, $end) {
		$arr = array (
				'req' => '5',
				'1' => $type,
				'2' => $key ,
				'3' => $start,
				'4' => $end 
		);
		$json_string = json_encode ( $arr );
		return Req_sfsHLSG::http_post_data ( Req_sfsHLSG::url, $json_string );
	}
	/**
	 * 打码账目
	 *
	 * @param unknown $type        	
	 * @param unknown $key        	
	 * @return mixed
	 */
	function GetDaMaAccount() {
		$arr = array (
				'req' => '6' 
		);
		$json_string = json_encode ( $arr );
		return Req_sfsHLSG::http_post_data ( Req_sfsHLSG::url, $json_string );
	}
	/**
	 *
	 * @param unknown $type        	
	 * @param unknown $key        	
	 * @return mixed
	 */
	function GetPaiLu() {
		$arr = array (
				'req' => '7',
				'1' => '329-32900102' 
		);
		$json_string = json_encode ( $arr );
		return Req_sfsHLSG::http_post_data ( Req_sfsHLSG::url, $json_string );
	}
	/**
	 *
	 * @return unknown
	 */
	function GetRealTimeSeatData() {
		$arr = array (
				'req' => '8',
				'1' => '329-32900102' 
		);
		$json_string = json_encode ( $arr );
		return Req_sfsHLSG::http_post_data ( Req_sfsHLSG::url, $json_string );
	}
	function SubmitCMD($cmdId) {
		$arr = array (
				'req' => '9',
				'1' => '329-32900102',
				'2' => $cmdId 
		);
		$json_string = json_encode ( $arr );
		return Req_sfsHLSG::http_post_data ( Req_sfsHLSG::url, $json_string );
	}
	function GetNetworkStatus() {
		$arr = array (
				'req' => '10' 
		);
		$json_string = json_encode ( $arr );
		return Req_sfsHLSG::http_post_data ( Req_sfsHLSG::url, $json_string );
	}
	/**
	 * 用户上分通知
	 *
	 * @return mixed
	 */
	function UserTopUp($name, $coin) {
		$arr = array (
				'req' => '11',
				'1' => $name,
				'2' => $coin 
		);
		$json_string = json_encode ( $arr );
		return Req_sfsHLSG::http_post_data ( Req_sfsHLSG::url, $json_string );
	}
	/**
	 * 清除数据
	 *
	 * @return mixed
	 */
	function ClearData() {
		$arr = array (
				'req' => '12' 
		);
		$json_string = json_encode ( $arr );
		return Req_sfsHLSG::http_post_data ( Req_sfsHLSG::url, $json_string );
	}
}
